package com.colin.app.activity.other.direction;

import android.content.res.Configuration;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.widget.TextView;

import com.colin.app.R;
import com.colin.app.activity.other.OtherContract;
import com.colin.app.activity.other.OtherPresenterImpl;
import com.colin.app.app.AppActivity;
import com.colin.app.bean.DemoBean;
import com.colin.library.help.LogHelp;

/**
 * 横竖屏处理
 */
public class DirectionActivity extends AppActivity implements OtherContract.OtherView {

    private OtherContract.OtherPresenter mOtherPresenter = null;
    private TextView text_direction_message;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
        super.onSaveInstanceState(outState, outPersistentState);
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
    }

    @Override
    protected void onDestroy() {
        if (null != mOtherPresenter) {
            mOtherPresenter.destroy();
            mOtherPresenter = null;
        }
        super.onDestroy();
    }

    @Override
    public void initPresenter() {
        DemoBean demoBean = getIntent().getExtras().getParcelable("clazz");
        mOtherPresenter = new OtherPresenterImpl(this, this, demoBean);

    }

    @Override
    public int initViewLayoutID() {
        return R.layout.activity_direction;
    }

    @Override
    public void initView() {
        this.text_direction_message = (TextView) this.findViewById(R.id.text_direction_message);
    }

    @Override
    public void initData() {
        mOtherPresenter.setData();

    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        LogHelp.e("Configuration:" + newConfig.toString());
        this.text_direction_message.append(newConfig.toString());
    }
}
